home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / dev / c / proto2fd.lha / proto2fd.doc < prev    next >
Text File  |  1995-10-31  |  3KB  |  87 lines

  1. Short:    SAS/C++ proto to fd converter
  2. Uploader: schneidr@igt.baum.ethz.ch
  3. Type:     dev/
  4.  
  5. ************************************************************************
  6.  
  7.                       Proto2FD v37.1 (30.10.1995)
  8.  
  9.                ⌐1994-95 Quarz Development / A.H.Schneider
  10.  
  11.                              - Freeware -
  12.  
  13. ************************************************************************
  14.  
  15.  
  16. This  is  a  little tool I wrote when creating a shared library with C++
  17. code  using  SAS/C++.  It  simly  does  what  its  name  tells:  convert
  18. prototypes to function description entries (.FD) (used to create pragmas
  19. for library calls).
  20.  
  21. Creating C code shared libraries with SAS/C++  6.56  is  a  pretty  easy
  22. task.  This  is  not  the case for C++! Not only you have to provide all
  23. your  class  declarations  AND  definitions  with  '__asm'  and   '__asm
  24. __saveds'  keywords. This you could bear. But you also have to create an
  25. entry in the function description file (.FD) for EACH of the  translated
  26. and *name-mangled* C-function of your C++ classes!!!
  27.  
  28. That's  where  this  tiny tool helps out. It just takes a prototype file
  29. generated with the SAS/C *GenProto* option as input an creates fast  and
  30. easy  for  every  function  with  the  keywords '__asm' and '__saveds' a
  31. function description entry into the output file.
  32.  
  33. The command syntax is:
  34.  
  35.         proto2fd <infile> [outfile]
  36.  
  37.         infile:  filename of the file  containing the prototypes created
  38.                  by SAS/C and the GenProto option.
  39.  
  40.         outfile: filename of the output file (optional). If left out, an
  41.                  appropriate filename with .fd extension will be created
  42.                  from the infile name.
  43.  
  44.  
  45. For example to create the FD file  from  'foo.cpp',  say  'foo.fd',  the
  46. following  steps  are  necessary  (assuming  the  class  declaration and
  47. definitions contain the '__asm' and '__saveds' keywords as described  in
  48. the 'SAS/C Library Reference'):
  49.  
  50.         1. First create C translation of 'foo.cpp',
  51.            > sc CxxOnly foo.cpp         ; this will create foo..c
  52.  
  53.         2. then create the prototypes file
  54.            > sc GenProto foo..c GenProtoParm GenProtoFile=foo.protos 
  55.  
  56.         3. and finally create 'foo.fd'
  57.            > proto2fd foo.protos foo.fd
  58.  
  59. Using smake you can easily automate the 3 steps by adding the  following
  60. rules and depencies to your makefile:
  61.  
  62. foo.fd:         foo.cpp
  63.  
  64. .cpp.fd:
  65.         sc cxxonly $?
  66.         sc genproto $*..c genprotoparm genprotofile=$*.protos
  67.         proto2fd $*.protos $@
  68.  
  69.  
  70.  
  71. If you have any problems using this tools or suggestions, please let me
  72. know.
  73.  
  74. Alex H. Schneider
  75.  
  76. schneidr@igt.baum.ethz.ch
  77.  
  78. ************************************************************************
  79.   If you know a faster way to do the above things, PLEASE let me know.
  80. ************************************************************************
  81.  
  82. Program History:
  83.         v37.1 (30.10.1995)      First public release
  84.  
  85. ************************************************************************
  86.  
  87.